Skip to content

[rust] Log a sanitized identifier only when it differs from the cased original - #25015

Merged
wing328 merged 2 commits into
OpenAPITools:masterfrom
HardMax71:rust-sanitize-identifier-noop-warning
Sep 28, 2026
Merged

wing328 merged 2 commits into
OpenAPITools:masterfrom
HardMax71:rust-sanitize-identifier-noop-warning

Conversation

@HardMax71

@HardMax71 HardMax71 commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #25014.

sanitizeIdentifier now warns only when the final name differs from the cased original name, so a hyphenated or dotted name that only changes case no longer logs "PetRecord cannot be used as a model name. Renamed to PetRecord". Real renames still log, e.g. reserved words, leading digits and special characters (ApplicationJson ... Renamed to ApplicationSlashJson). The nameWasModified flag went away because the comparison replaces it.

On GitHub's REST description (github/rest-api-description@3cef12e8) the rust generator goes from 4 min 39 s and a 1.0 GB log (6,961,556 warnings) to 5.0 s and 2 MB (3,259 warnings), with identical generated files. The new testSanitizeIdentifierWarnsOnlyOnRename fails on master.

PR checklist


Summary by cubic

Fixes #25014 by logging a sanitization warning only when the final name differs from the cased original. Case-only changes (e.g. pet-name → PetName) no longer log a false rename, while real renames like reserved words or special characters still do. On GitHub's REST description this cuts the Rust generator from 4m39s and a 1.0GB log to 5s and 2MB, with identical output. The new testSanitizeIdentifierWarnsOnlyOnRename fails on master and filters out log events from tests running in parallel.

Written for commit f759ab0. Summary will update on new commits.

Review in cubic

Copilot AI lite review requested due to automatic review settings September 26, 2026 23:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@wing328
wing328 merged commit ec4430e into OpenAPITools:master Sep 28, 2026
15 checks passed
@wing328 wing328 added this to the 7.26.0 milestone Sep 28, 2026
@wing328

wing328 commented Sep 28, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution to improve the Rust generators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][Rust] "X cannot be used as a model name. Renamed to X" is logged on every lookup of a hyphenated name

3 participants